/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Negocio;

/**
 *
 * @author sistemas
 */
public class Vector {
    public Vector() {
        this.n = n;
    }
    
    
    static final int max=200;
    private int n;
    private Negocio.Entero[]v=new Negocio.Entero[max];
    //<editor-fold defaultstate="collapsed" desc="comment">
    public Vector (int n){
        //</editor-fold>
    this.n = n;
    }
    public void setN(int n){
    this.n = n;
    }
    public int getN(){
    return n;
    }
    public void insertar_vector(Negocio.Entero ele){
    v[n]=ele;
    n++;
    }
    public Negocio.Entero leer_vector(int pos){
    return v[pos];
    }
    private void intercambiar(Negocio.Entero ele1,Negocio.Entero ele2){
    Negocio.Entero aux=new Entero();
    aux.setNum(ele1.getNum());
    ele1.setNum(ele2.getNum());
    ele2.setNum(aux.getNum());
    }
    public void Ordenar(){
    for(int i=0;i<=n-2;i++){
        for(int j=0;j<=n-1;j++){
                if(v[i].getNum()>v[j].getNum()){
                this.intercambiar(v[i], v[j]);
                }
            }
        }
    }
    public void Invertir(){
        for(int i=0;i<=n/2-1;i++){
        this.intercambiar(v[i],v[(n-1-i)]);
        }
    }
    
    public boolean Existe(int Ele){
        for(int i=0;i<=n-1;i++){
            if(v[i].getNum()==Ele){
            return true;
            }
        }
    return  false;
    }
  
    
}
